# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# pyojo                                           Copyright (c) 2011 nabla.net
# ----------------------------------------------------------------------------
""" Demo: pyojo.js.dijit.ToggleButton
"""
from pyojo.all import *
from pyojo.js.lib.demo import new_panel


def GET(request):

    button = form.ToggleButton(name = True,
                         label = 'Button',
                         showLabel = True,
                         checked = False,
                         #ID=True,
                         onChange = js.Function("val",
                                               "this.set('label', val)")
                        )
        
    panel = new_panel("Demo Button", "TABS")
    html = "<p>%s</p>" % raw_str(__doc__)
    html += "<pre>%s</pre>" % raw_str(form.ToggleButton.__doc__)
    panel["content"] = html
    
    return js.Require(button,
                      panel,
                      panel.domNode.appendChild(button.domNode),
                      "status('ToggleButton demo ready.');")
